package com.xwl.learn.chapter06;

import java.util.Scanner;

public class LearnFor {
    public void fore() {
        int sum = 0;
        for (int i = 1, j = 10, z = j >> 1; i <= z; i++, j--) {
            sum = (i + j);
        }
        System.out.println(sum);
    }

    public void forf() {
        int sum = 0;
        for (int i = 1, len = 10; i <= len; i++) {
            sum += i;
        }
        System.out.println(sum);
    }

    /**
     * //1、 1 2 3 2 1
     * //2、 100以内的某一个数据的倍数
     * //3、7的倍数以及包含7的数100以内
     * //4、文本扫描器的题 ：main 输入一个数,判断原数的值
     */

    public void lx1(){
        for (int i = 1;i<=3;i++){
            for (int j = 3; j<0;j--){
                System.out.print(i+"."+j);
            }
        }
    }

    public void lx2(int j) {
        for (int i = 0; i <= 100; i++) {
            if (i % j == 0) {
                System.out.println(i);
            }
        }
    }
    public void lx3(){
        int j = 7;
        for (int i = 0; i <= 100; i++){
            if (i % j == 0|| i % 10 == 7 || i /10 % 10 == 7){
                System.out.println(i);
            }
        }
    }
    public static void main(String []args){
        Scanner s1 = new Scanner(System.in);
        int j = 8;
        System.out.println("你需要输入一个0-10的数。");
        for (int i = 0; i<3;i++){
            int a = s1.nextInt();
            if (a == 8){
                System.out.println("猜对了");
                return;
            }else {
                System.out.println("第二次机会，请重新输入");
                if (a == 8){
                    System.out.println("猜对了");
                    return;
                }else {
                    if (a == 8){
                        System.out.println("猜对了");
                        return;
                    }else {
                        System.out.println("最后一次机会");
                    }
                }
            }

        }
        System.out.println("你的次数使用完了");
    }
}
